<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:insert="~{include :: header('修改导航')}" />
</head>
<body class="hold-transition">
<div class="container-fluid mt-2 mb-2">
        <form class="form-horizontal m" id="form-navigate-edit" th:object="${websiteNavigate}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group row">
                <label class="col-sm-2 col-form-label is-required text-sm-right">类型</label>
                <div class="col-sm-6">
                    <select name="type" th:field="*{type}" class="form-control m-b" required>
                        <option value="friend">友情链接</option>
                        <option value="tab">底部导航</option>
                        <option value="footer">手机导航</option>
                    </select>
                </div>
            </div>
            <div class="form-group row">
                <label class="col-sm-2 col-form-label is-required text-sm-right">名称</label>
                <div class="col-sm-6">
                    <input name="name" th:field="*{name}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group row">
                <label class="col-sm-2 col-form-label is-required text-sm-right">跳转地址</label>
                <div class="col-sm-6">
                    <input name="url" th:field="*{url}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group row">
                <label class="col-sm-2 col-form-label text-sm-right">在新页面打开</label>
                <div class="col-sm-6 form-text">
                    <th:block th:each="dict ,cStat: ${@dict.getType('qdx_navigate_newpage')}">
                        <input type="radio" th:id="${'newpage_' + dict.dictCode}" name="newPage" th:value="${dict.dictValue}" th:field="*{newPage}">
                        <label th:for="${'newpage_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </th:block>
                </div>
            </div>
            <div class="form-group row">
                <label class="col-sm-2 col-form-label text-sm-right">排序</label>
                <div class="col-sm-4">
                    <input name="sort" th:field="*{sort}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group row">
                <label class="col-sm-2 col-form-label text-sm-right">导航图片</label>
                <div class="col-sm-9">
                    <textarea name="image" th:text="*{image}" class="form-control"></textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:insert="~{include :: footer}" />
    <script type="text/javascript">
        var prefix = "/navigate";
        $("#form-navigate-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit.json", $('#form-navigate-edit').serialize());
            }
        }
    </script>
</body>
</html>